//
//  TrainListCell.m
//  Four_Fit_New
//
//  Created by xalo on 16/7/21.
//  Copyright © 2016年 xmaz. All rights reserved.
//

#import "TrainListCell.h"
#import "TrainListModel.h"

@interface TrainListCell ()
@property (weak, nonatomic) IBOutlet UIImageView *imageURL;
@property (weak, nonatomic) IBOutlet UILabel *planName;
@property (weak, nonatomic) IBOutlet UILabel *trainDuration;
@property (weak, nonatomic) IBOutlet UILabel *difficultyLevel;
@property (weak, nonatomic) IBOutlet UILabel *numberOfParticipants;
@property (weak, nonatomic) IBOutlet UILabel *calorie;
@end

@implementation TrainListCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setCellWithModel:(TrainListModel *)model{
    [self.imageURL layoutIfNeeded];
    self.imageURL.layer.cornerRadius = self.imageURL.frame.size.width / 2;
    self.imageURL.layer.masksToBounds = YES;
    [self.imageURL sd_setImageWithURL:[NSURL URLWithString:model.imageURL]];
    self.trainDuration.text = [NSString stringWithFormat:@"%@分钟",model.trainDuration];
    self.calorie.text = [NSString stringWithFormat:@"%@千卡",model.calorie];
    NSString *str = nil;
    if ([model.difficultyLevel isEqualToString:@"0"]) {
        str = @"初级";
    }else if ([model.difficultyLevel isEqualToString:@"1"]){
        str = @"中级";
    }else{
        str = @"高级";
    }
    self.difficultyLevel.text = str;
    self.numberOfParticipants.text = [NSString stringWithFormat:@"%@人",model.numberOfParticipants];
    self.planName.text = model.planName;
}
@end
